package com.kmust.dream.wanderingdream.donation.service.impl;

import com.kmust.dream.wanderingdream.comm.utils.PageUtils;
import com.kmust.dream.wanderingdream.comm.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.kmust.dream.wanderingdream.donation.dao.AwardInformationDonationDao;
import com.kmust.dream.wanderingdream.donation.entity.AwardInformationDonationEntity;
import com.kmust.dream.wanderingdream.donation.service.AwardInformationDonationService;


@Service("awardInformationDonationService")
public class AwardInformationDonationServiceImpl extends ServiceImpl<AwardInformationDonationDao, AwardInformationDonationEntity> implements AwardInformationDonationService {
    @Autowired
    AwardInformationDonationDao donationDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<AwardInformationDonationEntity> page = this.page(
                new Query<AwardInformationDonationEntity>().getPage(params),
                new QueryWrapper<AwardInformationDonationEntity>()
        );

        return new PageUtils(page);
    }

    public List<AwardInformationDonationEntity> getListByRId(String rid){
        QueryWrapper<AwardInformationDonationEntity> query = new QueryWrapper<>();
        query.eq("recipient_id",rid);
        return donationDao.selectList(query);
    }

}